package com.liu.example.control;

import com.liu.example.webscoket.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName TestController
 * @Description 接口调用方式发送消息
 * @Author laz
 * @Date 2023/4/26 16:23
 * @Version 1.0
 */
@RestController
@RequestMapping("web")
public class TestController {

    @Autowired
    private WebSocket webSocket;

    @RequestMapping("test")
    @GetMapping
    public String test(String userId, String msg, HttpServletRequest request, HttpServletResponse res){
        webSocket.sendOneMessage(userId,msg);
        return "成功";
    }
}

